Clojure Programming by Brian Carper Chas Emerick & Christophe Grand

Clojure Programming by Brian Carper Chas Emerick & Christophe Grand

Author:Brian Carper Chas Emerick & Christophe Grand [Chas Emerick, Brian Carper]
Language: eng
Format: mobi
Tags: COMPUTERS / Programming Languages / LISP, python
ISBN: 9781449394745
Publisher: O'Reilly Media, Inc.
Published: 2012-03-30T04:00:00+00:00


We now have type acting as the dispatch function for run, so that it will return the :type metadata on any passed maps, falling back to returning the class of the argument if no such metadata is available.

Of course, you could modify the dispatch function to explicitly check for a :run slot in any provided map to achieve the same end. However, what would happen if you wanted to be able to run some function you knew was available as the last element of vectors produced elsewhere in your application? You would need to modify your dispatch function to allow for that, thereby subverting a big part of the motivation of multimethods (and really, many of Clojure’s other facilities): to allow you to disentangle operations from the data that is being operated over.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.